Skip to main content

All Questions

1vote
1answer
106views

Finding the number of distinct decompositions a number has using only repdigits

This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
Lesserrafim's user avatar
7votes
2answers
1kviews

Find all combinations of length 3 whose sum is divisible by a given number

I came up with a suitable solution to a HackerRank problem that failed because the execution took longer than 10 seconds on lists that were of very large size. The problem: Given a list ...
NFeruch - FreePalestine's user avatar
8votes
3answers
294views

Refactor the code which performs "cross-product", "reduce", "product of list" and "sum of list"

I have come up with a sequence of steps to find the maximum product of y positive numbers which add up to x. But the program is ...
Yozachar's user avatar
2votes
2answers
561views

Counting block combinations I: Project Euler 114

Problem statement (For more detailed description (including pictures), please, visit the link): A row measuring seven units in length has red blocks with a minimum length of three units placed on ...
Stokolos Ilya's user avatar
4votes
1answer
648views

Counting Bouncy Numbers: Project Euler #113

Problem statement: Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468. Similarly if no digit is exceeded by the ...
Stokolos Ilya's user avatar
2votes
3answers
3kviews

Counting numbers that are divisible by 3 and can be produced from the digits of a given number

I'm trying to solve this problem from codewars. Problem Given a certain number, how many multiples of three could you obtain with its digits? Suppose that you have the number ...
tarit goswami's user avatar
2votes
2answers
982views

Project Euler # 24 Lexicographic permutations in Python

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we ...
user avatar
4votes
2answers
765views

Letter case permutation

The question can be found here https://leetcode.com/problems/letter-case-permutation Given a string S, we can transform every letter individually to be lowercase or uppercase to create another ...
user avatar
2votes
2answers
2kviews

Staircase challenge - Python

Your task is to print all unique ways to climb a staircase of length n where, from each step, you can take steps of size x where ...
MrJoe's user avatar
  • 2,133
5votes
1answer
2kviews

Project Euler 76: Counting summations

Project Euler Problem 76 asks: How many different ways can one hundred be written as a sum of at least two positive integers? My code is correct but just works slowly. ...
camarman's user avatar
1vote
2answers
916views

Lattice path from Project Euler with Python solution

I was trying to solve this problem called lattice path from Project Euler: Count the number of unique paths to travel from the top left to the bottom right of a lattice of squares. How many such ...
NinjaG's user avatar
  • 2,539
10votes
3answers
714views

Master Locksmith

Description Master Locksmith has just finished the work of his life: a combination lock so big and complex that no one will ever open it without knowing the right combination. He's done testing ...
Ludisposed's user avatar
2votes
1answer
93views

Total of maximum values in all subarrays

This is the crux of a problem found on one of those code challenge sites. I'm fairly new to programming and this was a difficult challenge. I've attempted to solve this with stacks and calculating ...
Paul K's user avatar
3votes
2answers
2kviews

Maximum sub-array of non-negative numbers

This is the "Maximum sub-array" problem from CodeChef: Find out the maximum sub-array of non negative numbers from an array. The sub-array should be continuous. That is, a sub-array created ...
Latika Agarwal's user avatar
8votes
2answers
1kviews

Python solution to Code Jam's 'Rounding Error'

The "Rounding Error" problem of Round 1B of Google Code Jam 2018 is as follows: Problem To finally settle the age-old question of which programming language is the best, you are asking a total ...
Eugene Yarmash's user avatar

153050per page
close